package com.jingyanzi.sys.text;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jingyanzi.sys.domain.BusinessTypeDO;
import com.jingyanzi.sys.domain.result.PageAll;
import com.jingyanzi.sys.domain.service.IBusinessService;


@RestController
@RequestMapping("/business")
public class BusinessDemo {
	
	@Autowired
	private IBusinessService iBusinessService;
	
	
	                        
	@RequestMapping("/add")
	public Object addIbuiness() {
		
		BusinessTypeDO businessTypeDO=new BusinessTypeDO();
		
		businessTypeDO.setBusinessId(0);
		businessTypeDO.setAuthor("程林");
		businessTypeDO.setCode("TM-5");
		return iBusinessService.addType(businessTypeDO);
	}

	@RequestMapping("/delete")
	public Object delete() {
		
		return iBusinessService.removeType(1, 4, "chenglin");
	}
	
	@RequestMapping("/update")
	public Object update() {
		BusinessTypeDO businessTypeDO=new BusinessTypeDO();
		businessTypeDO.setId(3);
		businessTypeDO.setBusinessId(1);
		businessTypeDO.setModifi("cl");
		businessTypeDO.setCode("TM-6");
		return iBusinessService.modifiType(businessTypeDO);
	}
	
	@RequestMapping("/showAll")
	public Object showAll() {
		
		PageAll page=new PageAll();
		page.setPageindex(1);
		page.setPagesize(10);
		return iBusinessService.queryType(null, page);
	}
	
	@RequestMapping("/select")
	public Object showSelect() {
		
		
		return iBusinessService.showSelect(1);
	}
}
